(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
check(0) → zero
check(s(0)) → odd
check(s(s(0))) → even
check(s(s(s(x)))) → check(s(x))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
times(x, y) → timesIter(x, y, 0)
timesIter(x, y, z) → if(check(x), x, y, z, plus(z, y))
p(s(x)) → x
p(0) → 0
if(zero, x, y, z, u) → z
if(odd, x, y, z, u) → timesIter(p(x), y, u)
if(even, x, y, z, u) → plus(timesIter(half(x), y, half(z)), timesIter(half(x), y, half(s(z))))
Rewrite Strategy: FULL
(1) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(2) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
check(0') → zero
check(s(0')) → odd
check(s(s(0'))) → even
check(s(s(s(x)))) → check(s(x))
half(0') → 0'
half(s(0')) → 0'
half(s(s(x))) → s(half(x))
plus(0', y) → y
plus(s(x), y) → s(plus(x, y))
times(x, y) → timesIter(x, y, 0')
timesIter(x, y, z) → if(check(x), x, y, z, plus(z, y))
p(s(x)) → x
p(0') → 0'
if(zero, x, y, z, u) → z
if(odd, x, y, z, u) → timesIter(p(x), y, u)
if(even, x, y, z, u) → plus(timesIter(half(x), y, half(z)), timesIter(half(x), y, half(s(z))))
S is empty.
Rewrite Strategy: FULL
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
TRS:
Rules:
check(0') → zero
check(s(0')) → odd
check(s(s(0'))) → even
check(s(s(s(x)))) → check(s(x))
half(0') → 0'
half(s(0')) → 0'
half(s(s(x))) → s(half(x))
plus(0', y) → y
plus(s(x), y) → s(plus(x, y))
times(x, y) → timesIter(x, y, 0')
timesIter(x, y, z) → if(check(x), x, y, z, plus(z, y))
p(s(x)) → x
p(0') → 0'
if(zero, x, y, z, u) → z
if(odd, x, y, z, u) → timesIter(p(x), y, u)
if(even, x, y, z, u) → plus(timesIter(half(x), y, half(z)), timesIter(half(x), y, half(s(z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
check,
half,
plus,
timesIterThey will be analysed ascendingly in the following order:
check < timesIter
half < timesIter
plus < timesIter
(6) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
check, half, plus, timesIter
They will be analysed ascendingly in the following order:
check < timesIter
half < timesIter
plus < timesIter
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
check(
gen_0':s3_0(
+(
1,
*(
2,
n5_0)))) →
odd, rt ∈ Ω(1 + n5
0)
Induction Base:
check(gen_0':s3_0(+(1, *(2, 0)))) →RΩ(1)
odd
Induction Step:
check(gen_0':s3_0(+(1, *(2, +(n5_0, 1))))) →RΩ(1)
check(s(gen_0':s3_0(*(2, n5_0)))) →IH
odd
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(8) Complex Obligation (BEST)
(9) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
half, plus, timesIter
They will be analysed ascendingly in the following order:
half < timesIter
plus < timesIter
(10) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
half(
gen_0':s3_0(
*(
2,
n249_0))) →
gen_0':s3_0(
n249_0), rt ∈ Ω(1 + n249
0)
Induction Base:
half(gen_0':s3_0(*(2, 0))) →RΩ(1)
0'
Induction Step:
half(gen_0':s3_0(*(2, +(n249_0, 1)))) →RΩ(1)
s(half(gen_0':s3_0(*(2, n249_0)))) →IH
s(gen_0':s3_0(c250_0))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(11) Complex Obligation (BEST)
(12) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
half(gen_0':s3_0(*(2, n249_0))) → gen_0':s3_0(n249_0), rt ∈ Ω(1 + n2490)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
plus, timesIter
They will be analysed ascendingly in the following order:
plus < timesIter
(13) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
plus(
gen_0':s3_0(
n571_0),
gen_0':s3_0(
b)) →
gen_0':s3_0(
+(
n571_0,
b)), rt ∈ Ω(1 + n571
0)
Induction Base:
plus(gen_0':s3_0(0), gen_0':s3_0(b)) →RΩ(1)
gen_0':s3_0(b)
Induction Step:
plus(gen_0':s3_0(+(n571_0, 1)), gen_0':s3_0(b)) →RΩ(1)
s(plus(gen_0':s3_0(n571_0), gen_0':s3_0(b))) →IH
s(gen_0':s3_0(+(b, c572_0)))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(14) Complex Obligation (BEST)
(15) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
half(gen_0':s3_0(*(2, n249_0))) → gen_0':s3_0(n249_0), rt ∈ Ω(1 + n2490)
plus(gen_0':s3_0(n571_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n571_0, b)), rt ∈ Ω(1 + n5710)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
timesIter
(16) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol timesIter.
(17) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
half(gen_0':s3_0(*(2, n249_0))) → gen_0':s3_0(n249_0), rt ∈ Ω(1 + n2490)
plus(gen_0':s3_0(n571_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n571_0, b)), rt ∈ Ω(1 + n5710)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(18) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
(19) BOUNDS(n^1, INF)
(20) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
half(gen_0':s3_0(*(2, n249_0))) → gen_0':s3_0(n249_0), rt ∈ Ω(1 + n2490)
plus(gen_0':s3_0(n571_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n571_0, b)), rt ∈ Ω(1 + n5710)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(21) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
(22) BOUNDS(n^1, INF)
(23) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
half(gen_0':s3_0(*(2, n249_0))) → gen_0':s3_0(n249_0), rt ∈ Ω(1 + n2490)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(24) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
(25) BOUNDS(n^1, INF)
(26) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(27) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
(28) BOUNDS(n^1, INF)